<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>location</title>
</head>
<body>
<a id="a"></a>
<!---->
<script>
var hostname =location.hostname;
var pathname =location.pathname;
var port =location.port;
var protocol =location.protocol;
var href =location.href;
var txt ='hostname:'+hostname+'\r\n'+'pathname:'+pathname+'\r\n'+'port:'+port+'\r\n'+'protocol:'+protocol+'\r\n'+'href:'+href;
document.getElementById('a').innerHTML=txt
</script>
</body>
</html>